#pragma once
#include <Allegro.h>
#include <string>

class Sound
{
public:
	Sound(void);
	~Sound(void);

	SAMPLE *sample;

	void play(bool loop = 0);// 1 - sound will be looped
	void loadWave(std::string filename);
	inline void setVolume(unsigned int v);
	unsigned int getVolume(){return volume;};
	inline void setPan(unsigned int v);
	unsigned int getPan(){return pan;};
	inline void setPitch(unsigned int v);
	unsigned int getPitch(){return pitch;};

protected:
	unsigned int volume, pan; // range 0-255
	unsigned int pitch; //1000 - default
	bool loop;
};

void Sound::setVolume(unsigned int v)
{
	volume = v;
	adjust_sample(sample, volume, pan, pitch, loop);
}

void Sound::setPan(unsigned int v)
{
	pan = v;
	adjust_sample(sample, volume, pan, pitch, loop);
}

void Sound::setPitch(unsigned int v)
{
	pitch = v;
	adjust_sample(sample, volume, pan, pitch, loop);
}

